/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Reports.GenHTMLReport;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 *
 * @author leng
 */
public class genClassMatcher {
    String      str_filename = "Class matcher.html";

    String[]    str = {
"<html>",
"<head><title>Class matcher</title></head>",
"<body>",
"<h1>Class matcher</h1>",
"Annotations match if they have the same class assignment and their spans overlap.",
"<hr>",
"<p>For more detailed documentation on IAA please see the <a href=\"http://knowtator.sourceforge.net//iaa.shtml\">IAA documentation</a>.",
"<p>",
"<h2>3-way IAA Results</h2>",
"IAA calculated on 5 documents.",
"<p><a href=\"Class matcher.dat\">tabular data</a>",
"<p>all annotations = matches + non-matches",
"<br> IAA = matches / all annotations",
"<p>",
"<table border=1><tr><td><b>Type</b></td><td><b>IAA</b></td>",
"<td><b>matches</b></td>",
"<td><b>non-matches</b></td>",
"</tr>",
"<tr><td><b>All classes</b></td><td>75.42%</td><td>1077</td><td>351</td></tr>",

"<tr><td>ClinicalCondition</td><td>67.92%</td><td>360</td><td>170</td></tr>",
"<tr><td>Medication</td><td>77.14%</td><td>27</td><td>8</td></tr>",
"<tr><td>Person</td><td>91.16%</td><td>567</td><td>55</td></tr>",
"<tr><td>Procedure</td><td>51.04%</td><td>123</td><td>118</td></tr>",

"</table>",
"<h2>match data</h2>",
"<ul>",
"<li><a href=\"Class matcher.matches.Jan , .html\">matches for Jan , </a></li>",
"<li><a href=\"Class matcher.matches.Tyler , .html\">matches for Tyler , </a></li>",
"<li><a href=\"Class matcher.matches.Ryan , .html\">matches for Ryan , </a></li>",
"</ul><hr>",
"<h2>non-match data</h2>",
"<ul>",
"<li><a href=\"Class matcher.nonmatches.Jan , .html\">non-matches for Jan , </a></li>",
"<li><a href=\"Class matcher.nonmatches.Tyler , .html\">non-matches for Tyler , </a></li>",

"<li><a href=\"Class matcher.nonmatches.Ryan , .html\">non-matches for Ryan , </a></li>",
"</ul><hr>",
"<h2>Pair-wise agreement</h2>",
"<table border=1><tr><td><b>Gold standard set</b></td><td><b>compared set</b></td><td><b>true positives</b></td><td><b>false positives</b></td><td><b>false negatives</b></td><td><b>precision</b></td><td><b>recall</b></td><td><b>F-score</b></td></tr>",
"<tr><td>Jan , </td><td>Tyler , </td><td>425</td><td>72</td><td>62</td><td>85.51%</td><td>87.27%</td><td>86.38%</td></tr>",

"<tr><td>Jan , </td><td>Ryan , </td><td>381</td><td>63</td><td>106</td><td>85.81%</td><td>78.23%</td><td>81.85%</td></tr>",
"<tr><td>Tyler , </td><td>Jan , </td><td>425</td><td>62</td><td>72</td><td>87.27%</td><td>85.51%</td><td>86.38%</td></tr>",

"<tr><td>Tyler , </td><td>Ryan , </td><td>395</td><td>49</td><td>102</td><td>88.96%</td><td>79.48%</td><td>83.95%</td></tr>",
"<tr><td>Ryan , </td><td>Jan , </td><td>381</td><td>106</td><td>63</td><td>78.23%</td><td>85.81%</td><td>81.85%</td></tr>",

"<tr><td>Ryan , </td><td>Tyler , </td><td>395</td><td>102</td><td>49</td><td>79.48%</td><td>88.96%</td><td>83.95%</td></tr>",
"</table>",
"Precision and recall are given equal weight for the F-score.",

    };

    /**output
     * @return
     *      return value bigger than 0      : success
     *      return value smaller than 0     : failed
     */
    public int output(String strAbsolutePath){
        try{
            String separator = File.pathSeparator;
            String file = strAbsolutePath + str_filename;
            FileOutputStream output = new FileOutputStream(file);
            

            PrintStream p = new PrintStream(output);
            for(int i=0;i< str.length; i++){
                p.append(str[i]);
            }
            p.close();
            return 1;

        }catch(Exception ex){
            System.out.println("error 1101101403:: fail to output index.html!!"
                    + ex.toString() );
            return -1;
        }
    }
}
